function Resource(type, id, callback) {
	this.show = function() {
		var rc = 'id'+type+'.'+id;
		var div = $(rc);
		if (div != null) {
			Dialog(rc).show();
			return;
		}

		ajax.send('index.php?m=public&a=viewinfo&suppressHeaders=1&type='+type+'&id='+id, '',
			function(result) {
				div = document.createElement('div');
				document.body.appendChild(div);
				div.setAttribute('autohide', 'click');
				div.style.visibility = 'hidden';
				div.style.padding = '0px';
				div.className = 'popup';
				div.innerHTML = result;
				div.id = rc;

				Dialog(rc).show();

				if (typeof(callback) == 'function')
					callback();
			}
		);
	}
	return this;
}

function User(id) {
	this.inheritFrom = Resource;
	this.inheritFrom('User', id);

	return this;
}

function Company(id) {
	this.inheritFrom = Resource;
	this.inheritFrom('Company', id);

	return this;
}

function DepartmentList(id, callback) {
	this.inheritFrom = Resource;
	this.inheritFrom('DepartmentList', id, callback);

	return this;
}
